<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><{:C('web_site_name')}>-后台新闻类别管理</title>
<link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/common.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/main.css"/>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/lib.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/layer.min.js"></script>
</head>
<body>



<div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i>首页<span class="crumb-step">&gt;</span><span class="crumb-name">新闻类别</span></div>
        </div>
        
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="javascript:void(0)" onclick="add_type(0)"><i class="icon-font"></i>添加顶层栏目</a>
                       
                    </div>
                </div>
                 <div class="list-page" id="page_string"> 2 条 1/1 页</div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            
                            <th>编号</th>
                            <th>新闻类别</th>
                            <th>父级Id</th>
                            <th>排序</th>
                            <th>SeO标题</th>
                            <th>关键词</th>
                            <th>描述</th>
                      		<th>path</th>
                      		<th>小图</th>
                      		<th>状态</th>
                            <th>操作</th>
                        </tr>
                        <tbody id="result_"></tbody>
                       
                    </table>
                     <div class="list-page" id="page_string"> 2 条 1/1 页</div>
                </div>
            </form>
        </div>
       
        
    
   </body>
   </html>    
   
<script>
var loadding_0;
$(function(){
	common_request(1);
  
});
function common_request(page){
	var url="<?php echo U("newstype/index");?>&inajax=1";
	var data_ = {
		'page':page,
		'time':<?php echo time();?>,
		'action':'ajax_data' , 
		'rolename':$("input[name='rolename']").val() 
	} ;
	$.ajax({
	type: "POST",
	url: url ,
	data: data_,
	cache:false,
	dataType:"json",
	 async:true,
	success: function(msg){
		var shtml = '' ;
		var list = msg.resultinfo.list;
		
		if(msg.resultcode != 1 ){
			layer.msg(msg.resultinfo.errmsg);
			return false ;
		}else{
		
			for(var i in list){
				shtml+='<tr id="tr_'+list[i].id+'">';
				shtml+= '<td>'+list[i].id+'</td>' ;
				shtml+='<td>'+list[i]['html']+list[i]['typename']+list[i]['num']+'</td>';
				shtml+='<td >'+list[i]['pid']+'</td>';
				shtml+='<td>'+list[i]['disorder']+'</td>';
				shtml+='<td>'+list[i]['seotitle']+'</td>';
				shtml+='<td>'+list[i]['keywords']+'</td>';
				shtml+='<td>'+list[i]['description']+'</td>';
				shtml+='<td>'+list[i]['path']+'</td>';
				shtml+='<td>'+list[i]['pic']+'</td>';
				shtml+='<td>'+list[i]['status']+'</td>';
				shtml+='<td><a href="javascript:void(0)" onclick="add_type('+list[i]['id']+')" >添加栏目</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="edit_type('+list[i]['id']+')" >编辑</a></td>';
				shtml+='</tr>';
			}
			$("#result_").html(shtml);
			$(".list-page").html(msg.resultinfo.obj);
		}
		layer.close(loadding_0);
	},
	beforeSend:function(){
		 loadding_0 = layer.load('数据正在加载中。。。。。。'); 
	},
	error:function(){
		layer.msg('服务器繁忙请稍后');
		return false ;
	}
	});
}

//添加栏目
var __add  ; 
function add_type(id){
	__add = $.layer({
	    type: 2,
	    shadeClose: true,
	    title: "添加栏目",
	    closeBtn: [0, true],
	    shade: [0.8, '#000'],
	    border: [1],
	    offset: ['20px',''],
	    area: ['720px','660px'],
        fix:false,
	    iframe: {src: "<?php echo U("newstype/add");?>&showpage=1&pid="+id}
	}); 
}
function close_add_div(){
	layer.close(__add);
}
function close_edit_div(){
	layer.close(__edit);
}
var __edit;
function edit_type(id){
	__edit = $.layer({
	    type: 2,
	    shadeClose: true,
	    title: "修改栏目",
	    closeBtn: [0, true],
	    shade: [0.8, '#000'],
	    border: [1],
	    offset: ['20px',''],
	    area: ['720px','660px'],
        fix:false,
	    iframe: {src: "<?php echo U("newstype/edit");?>&showpage=1&id="+id}
	}); 
}

function  jump_news(typeid){
    window.location.href="<{:U('news/index')}>&typeid="+typeid;
}

</script>
        